<template>
  <div>
    <el-tabs v-model="activeTab">
      <el-tab-pane name="1" label="已推荐">
        <el-form :inline="true">
          <el-form-item label="高中">
            <HighSchoolSelect v-model="school" />
          </el-form-item>
          <el-form-item label="地区">
            <AreaSelect v-model="area" />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="handleSearch">搜索</el-button>
          </el-form-item>
        </el-form>
        <el-table v-loading="table.loading" border :data="table.data">
          <el-table-column label="昵称" prop="user.nick_name" />
          <el-table-column label="姓名" prop="user.name" />
          <el-table-column label="学校" prop="user.school.title" />
          <el-table-column label="地区" prop="user.area.labels" />
        </el-table>
        <WrapPagination>
          <el-pagination
            class="pagination"
            :current-page="table.page"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="table.size"
            layout="total,prev, pager, next"
            :total="table.total"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
          />
        </WrapPagination>
      </el-tab-pane>
      <el-tab-pane name="2" label="未推荐">
        <UnRecommend @notify="getList" />
      </el-tab-pane>
    </el-tabs>

  </div>
</template>

<script>
import { TableMixin } from '../../../components/mixin'
import { showAcademyFollows } from '../../../api/admin'

export default {
  components: {
    UnRecommend: () => import('./un-recommend'),
    AreaSelect: () => import('../../../components/AreaSelect'),
    HighSchoolSelect: () => import('../../../components/HighSchoolSelect')
  },
  mixins: [TableMixin],
  data() {
    return {
      activeTab: '1',
      area: [],
      school: ''
    }
  },
  mounted() {
    this.getList()
  },
  methods: {
    getList() {
      this.wrapResourceList(showAcademyFollows, {
        academy_code: this.$route.params.academy_code,
        area: this.area,
        school: this.school
      })
    },
    handleSearch() {
      this.table.page = 1
      this.getList()
    }
  }
}
</script>

<style scoped>

</style>
